home *** CD-ROM | disk | FTP | other *** search
/ boe.pres.k12.wv.us / boe.pres.k12.wv.us.zip / boe.pres.k12.wv.us / Utilities / Xerox Workcentre 5335 / Windows Scan / 32-bit_x86 / Francais / cpsimage.cab / data / docio / docioTransformPage.elf < prev    next >
Text File  |  2009-03-16  |  3KB  |  83 lines

  1. // $Id: docioTransformPage.elf,v 1.12 2008/07/10 20:25:53 campanel Exp $
  2.  
  3. /* @docioTransformPage
  4. // DESCRIPTION
  5. docioTransformPage is a script that will take a page from a DOCUMENTWRITER
  6. or other XIPIMAGE source and transform it to meet the specification of a
  7. given DOCUMENTWRITER. The specification is obtained from the writer in the
  8. TRANSFORMSPEC list. In this script the specification is not modified. Other
  9. scripts and classes are available that do adjust the specification. For
  10. examples see: docFormatSISO.elf and DOCFORMATCONTROLLER class
  11.  
  12. // PARAMETERS
  13. XIPIMAGE srcimg - Provide the image that will be prepared per specification
  14. DOCUMENTWRITER destwtr - A fully instanciated writer (must already have been
  15. attached to a file writer).
  16. INTEGER loglevel - one or more bit flags (sum): 2 = trace, 4 = show vars
  17. */
  18.  
  19. /**********************************************************************************/
  20. /*****************************   SCRIPT ENTRY *************************************/
  21. /**********************************************************************************/
  22. #import "documentio.ucm";
  23. #load "docio/doctransforms.elf";
  24. LoadClasses ( filename: "xeng" );
  25.  
  26. STATUS status;
  27. BOOLEAN usingSameImg;
  28.  
  29. try
  30. {
  31.     IMPORT XIPIMAGE srcimg;
  32.     IMPORT DOCUMENTWRITER destwtr;
  33.     IMPORT INTEGER loglevel = 0;
  34.     
  35.     BOOLEAN doTrace = FALSE;
  36.     if (loglevel & 2) doTrace = TRUE;
  37.  
  38.     if (loglevel & 4)
  39.           help "var";
  40.     
  41.     if (doTrace)
  42.         print "***Running docioTransformPage script";
  43.  
  44.     // Just for fun, lets add a rotation...get the transform spec reference and set an attribute
  45.     //print "Adding rotation";
  46.     //LIST allspecs = destwtr.refSpecs();
  47.     //TRANSFORMSPEC dwts = allspecs.ref(entry:0);
  48.     //dwts.setAttr(name:"IOP_rotate", obj:90);
  49.  
  50.     if (doTrace)
  51.     {
  52.         STRING pn = srcimg.getAttr(name:"DIOPageNum");
  53.         print "docioTransformPage: src id is "+pn;
  54.         pn = destwtr.getFilename( );
  55.         print "docioTransformPage: destination is "+pn;
  56.     }
  57.  
  58.     // Invoke transformation procedure to get new image
  59.     XIPIMAGE destimg;
  60.     TransformPage (inpage:srcimg, todoc:destwtr, doTrace:doTrace)
  61.             RETURNS (outpage:destimg, isOriginal:usingSameImg);
  62.     if (!destimg)
  63.     {
  64.         SetStatus(op:"continue", msg:"Transfomation of page failed");
  65.         print "***Empty transformation page";
  66.         return;
  67.     }
  68.  
  69.     //  Insert the page
  70.     if (doTrace)
  71.         print "docioTransformPage: appending page image from TransformPage to DOCUMENTWRITER";
  72.     INTEGER pgcnt = destwtr.appendPage(pgImg:destimg);
  73.     if (usingSameImg == FALSE)
  74.     {
  75.         if (doTrace) print "docioTransformPage: free new image";
  76.         delete(destimg);
  77.     }
  78. } // End the try block
  79. catch
  80. {
  81.     print "***Error in docioTransformPage script: " + status.message;
  82. }
  83.